import React, { Component, Suspense } from "react";
import { connect } from "dva";

import { Modal, Tabs, Icon } from "antd";
import GridContent from "@/components/PageHeaderWrapper/GridContent";
import PageHeaderWrapper from "@/components/PageHeaderWrapper";
import PageLoading from "@/components/PageLoading";

const RightDrawer = React.lazy(() => import("../common/Drawer"));
const GlobalSet = React.lazy(() => import("../globalSet/GlobalSet"));
const SpecialCase = React.lazy(() => import("../specialCase/SpecialCase"));
const { TabPane } = Tabs;

class SpecialList extends Component {
	state = {
		specialVisible: true,
	};

	componentDidMount() {}

	onClose = () => {
		this.setState({ specialVisible: false });
	};

	render() {
		return (
			<GridContent>
				<Suspense fallback={<PageLoading />}>
					<PageHeaderWrapper>
						<Tabs defaultActiveKey='2'>
							<TabPane tab='全局设置' key='1'>
								<GlobalSet></GlobalSet>
							</TabPane>
							<TabPane tab='特殊情况处理' key='2'>
								<SpecialCase type='2'></SpecialCase>
							</TabPane>
						</Tabs>
						<RightDrawer
							title='返回列表'
							model='specialAdd'
							visible={this.state.specialVisible}
							onClosed={this.onClose}
						/>
					</PageHeaderWrapper>
				</Suspense>
			</GridContent>
		);
	}
}

export default connect(({ user }) => ({
	currentUser: user.currentUser,
}))(SpecialList);
